<?php
/*------------------------------------------------------------------------
# com_vportfolio - Vportfolio component
# ------------------------------------------------------------------------
# author    Vsmart Extensions
# copyright Copyright (C) 2010 www.vsmart-extensions.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.vsmart-extensions.com
# Technical Support:  Forum - http://www.vsmart-extensions.com
-------------------------------------------------------------------------*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

$cparams = JComponentHelper::getParams ('com_media');
$url = JURI::base();
?>

<div class="componentheading">
	<div class="titlecase">
	<?php echo JText::_( $this->config->cf_heading ).' - '.$this->item->title; ?>
    
	</div>
	<div class="nextprev" >	
		<?php if ($this->prev->id == '') : ?>
			<span class="previds">&laquo;Previous</span>
		<?php else : ?>
			<a class="previd" href="<?php echo $this->prevlink;?>" title="<?php $this->prev->title;?>" >
				<span>&laquo;Previous</span>
			</a>
		<?php endif; ?>
		
		<?php if ($this->next->id == '') : ?>
			<span class="nextids">Next&raquo;</span>
		<?php else : ?>
			<a class="nextid" href="<?php echo $this->nextlink; ?>" title ="<?php $this->next->title; ?>"><span>Next&raquo;</span></a>
		<?php endif; ?>	
		
	</div>
	
	
</div>
<div id="component-portfolio">
	<div class="casestudy">
	<div id="sh-left">
    	<h3><?php echo $this->item->title; ?></h3>
<?php if($this->config->cf_allow_rating){ ?>
<script type="text/javascript">
jQuery(function(){
 jQuery('.auto-submit-star').rating({
  callback: function(value, link){
			jQuery.ajax({
			   type: "POST",
			   async: false,
			   url: "<?php echo $url."/index.php"; ?>",
			   data: "option=com_vportfolio&task=rate&id=<?php echo $this->item->id; ?>&rate=" + value,
			   success: function(html){
				 document.getElementById('rating_').innerHTML = html;
				 $(function(){ $('input[@type=radio].auto-submit-star').rating(); });
			   }
			});
  }
 });
});
</script>
	<div id="rating_">
	 <div class="Clear">
		<input name="test-3A-rating-1" type="radio" class="auto-submit-star" <?php if($this->item->rating == 1) echo 'checked="checked"'; ?>  value="1"/> 
		<input name="test-3A-rating-1" type="radio" class="auto-submit-star" <?php if($this->item->rating == 2) echo 'checked="checked"'; ?>  value="2"/> 
		<input name="test-3A-rating-1" type="radio" class="auto-submit-star" <?php if($this->item->rating == 3) echo 'checked="checked"'; ?>  value="3"/> 
		<input name="test-3A-rating-1" type="radio" class="auto-submit-star" <?php if($this->item->rating == 4) echo 'checked="checked"'; ?>  value="4"/> 
		<input name="test-3A-rating-1" type="radio" class="auto-submit-star" <?php if($this->item->rating == 5) echo 'checked="checked"'; ?>  value="5"/> 
	  </div>
	</div>
<?php } ?>
        <div class="clear_both"></div>
        <div class="desProduct">
        	<?php echo $this->item->description; ?>
			<?php if($this->item->url != '') : ?>
				<p>Visit website : <a title="" target="_self" href="<?php echo $this->item->url ?>" class="caption"><?php echo $this->item->url ?></a></p>
				<?php endif; ?>
        </div>
		
        <h4><?php echo JText::_( 'Details' ); ?></h4>
        <ul class="itemDetails">
        	<?php if($this->item->url !="" && $this->config->cf_url){ ?>
        	<li>Web site: <a href="<?php echo $this->item->url; ?>"><?php echo $this->item->url; ?></a></li>
            <?php } ?>
        	<li>Page views: <?php echo $this->item->hit; ?></li>
        	<li>Date created: <?php echo $this->item->date_created; ?></li>
            <li>Last updated: <?php echo $this->item->last_modify; ?></li>
        </ul>
        <?php if($this->config->cf_extra) {
				 if( $this->item->type !="" || $this->item->specification !="" || $this->item->developers !=""){?>
        <h3><?php echo JText::_( 'Specifications' ); ?></h3>
        <ul class="itemSpecification">
        	<?php if($this->item->type) { 
				$typeConfig = explode(",",$this->config->cf_type);
				$typestring = explode(",",$this->item->type );
				$type=array();
				foreach( $typestring AS $row)
				{
					$row =  intval($row - 1);
					$type[] = $typeConfig[$row];				
				}
				$type = implode(",", $type);
			?>
        		<li>Type: <?php echo $type; ?></li>
            <?php } ?>
            <?php if($this->item->specification !="") { ?>
           		 <li>Specification: "<?php echo $this->item->specification; ?>".</li>
             <?php } ?>
            <?php if($this->config->cf_cb && $this->item->users){
			 ?>
            		<li>
                    	Authors:
                        <?php
							for($i=0;$i<sizeof($this->item->users);$i++){
								$user_link = $url."index.php?option=com_comprofiler&task=userProfile&user=".$this->item->users[$i]->id;
							?>
                            <a href="<?php echo $user_link; ?>"><?php echo $this->item->users[$i]->name; ?></a>
                            
                            <?php
								if($i != (sizeof($this->item->users) - 1))
									echo ",";
							}
						?>
                    </li>
                
             <?php }else{ ?>
             	<?php if($this->item->developers !="") { ?>
            		 <li>Authors: <?php echo $this->item->developers; ?></li>
             <?php	} 
			 	} ?>
        </ul>
        <?php }
			}
		?>
        
    </div>
    <div id="sh-right">
    	<div id="main-image">
        	<?php if($this->item->images){ ?>
        			<a rel="prettyPhoto[gallery]" href="<?php echo $url."components/com_vportfolio/images/".$this->item->id."/".$this->item->images[0]->imageName; ?>"><img src="<?php echo $url."components/com_vportfolio/images/".$this->item->id."/".$this->item->images[0]->imageName; ?>" border="0" alt="<?php echo $this->item->images[0]->imageTitle; ?>" /></a>
                 <?php } else{ ?>
                 	<img src="<?php echo $url."components/com_vportfolio/images/no_image.gif"; ?>" border="0"/>
                 <?php } ?>
        </div>
        <div id="sub-image">
        	<?php
				for($i=1;$i<sizeof($this->item->images);$i++){
				?>
                	<a rel="prettyPhoto[gallery]" href="<?php echo $url."components/com_vportfolio/images/".$this->item->id."/".$this->item->images[$i]->imageName; ?>"  ><img src="<?php echo $url."components/com_vportfolio/images/".$this->item->id."/".$this->item->images[$i]->imageName; ?>" border="0" alt="<?php echo $this->item->images[$i]->imageTitle; ?>" /></a>
                <?php
				}
			?>
        </div>
        	<?php 
				if($this->item->contact_link != ""){
					?><div id="contact-link">
                    	<a href="<?php echo $this->item->contact_link; ?>" target="_blank">
                        	<img src="<?php echo $url."components/com_vportfolio/images/contact_button.png";?>" />
                        </a></div>
                    <?php
				}else{
					if($this->config->cf_contact_link !=""){
					?>
                    	<div id="contact-link"><a href="<?php echo $this->config->cf_contact_link; ?>" target="_blank" >
                        	<img src="<?php echo $url."components/com_vportfolio/images/contact_button.png";?>"/>
                        </a></div>
                    <?php
					}
				}
			?>
    </div>
	<?php if($this->item->fulldescription !=""){ ?>
	<div id="fulldes"> 
		<?php echo $this->item->fulldescription; ?>
	</div>
	<?php } ?>
	<?php if($this->config->cf_review){?>
        <h4><?php echo JText::_( 'Customer Reviews' ); ?></h4>
        <ul class="customerReview" id="customerReview">
             <?php if($this->item->reviews){?>
				<?php for($i=0;$i<sizeof($this->item->reviews);$i++){ ?>
                <li>
                    <p>
                        <?php echo $this->item->reviews[$i]->review; ?>
                    </p>
                    <i>- <?php echo $this->item->reviews[$i]->customer; ?> - </i>
                </li>
                 <?php } 
				 }
				 ?>
                 
        </ul>
        <?php } ?>
        <?php 
			if($this->config->cf_allow_review) 
				echo $this->loadTemplate('review_form'); 
		?>
	</div>
	
	</div>
</div>

